package com.winit.deploy.task.springBootTask;

import com.winit.core.task.Task;
import com.winit.deploy.server.WinitSpringBootServer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Created by wangjian on 16/8/10.
 * 发布任务step2 停server
 */
public class SpringBootStopTask extends Task {

    static final Logger logger = LoggerFactory.getLogger(SpringBootStopTask.class);

    private WinitSpringBootServer server;

    public SpringBootStopTask(String taskId, Integer expireTime, WinitSpringBootServer server){
        super(taskId, expireTime);
        this.server = server;
    }

    @Override
    public TaskStatus call() throws Exception {
        logger.info("com.winit.deploy.task.springBootTask.SpringBootStopServerTask#call start taskId=" + taskId);
        this.server.doStopServer();
        logger.info("com.winit.deploy.task.springBootTask.SpringBootStopServerTask#call end taskId=" + taskId);
        return TaskStatus.STATUS_SUCCESS;
    }
}
